<?php
/* @var $this UserController */
/* @var $model Register1 */
/* @var $form CActiveForm  */

$this->pageTitle = Yii::app()->name . ' - Đăng ký';
$this->breadcrumbs = array(
    'Đăng ký',
);

Yii::import('ext.facebook.Facebook');
Yii::import('ext.google.Google_Client');
Yii::import('ext.google.contrib.Google_Oauth2Service');
//Yii::import('ext.twitter.TwitterOAuth');

$client = new Google_Client ();
$client->setClientId('203837015752-29f519lfk8u4fnrqmpljjmeke5rankfm.apps.googleusercontent.com');
$client->setClientSecret('CdtV1qBYhuIT7qWT1gr-sg4w');
$client->setDeveloperKey('AIzaSyAYxdSycRBJ6Q2HHabMDBnbiGICBkaFrE8');
$client->setRedirectUri(Yii::app()->createAbsoluteUrl('user/googlelogin'));
$client->setScopes("email https://www.googleapis.com/auth/userinfo.profile");
//$authUrl = $client->createAuthUrl();

$facebook = new Facebook(array(
    'appId' => '128317560709307',
    'secret' => 'feb508a994e8f14286f48b74efff5291'
        ));
$params = array(
    'scope' => 'email,user_photos,user_location,user_status,publish_stream,offline_access,read_stream,photo_upload',
    'redirect_uri' => Yii::app()->createAbsoluteUrl('user/fblogin')
);

//$twitteroauth = new TwitterOAuth('c1ov9I3pAkUnRWebRug', 'Gwn4Soquts69Pj1P49YYMU99ecPpX3NoqcifKglGwA');
//$request_token = $twitteroauth->getRequestToken(Yii::app()->createAbsoluteUrl('user/twlogin'));
// Saving them into the session
//$_SESSION ['oauth_token'] = $request_token ['oauth_token'];
//$_SESSION ['oauth_token_secret'] = $request_token ['oauth_token_secret'];
//$tw_login_url = $twitteroauth->getAuthorizeURL($request_token ['oauth_token']);
?>

<!-- register -->
<div id="register">
    <div class="content">
        <div class="reg_title"><h1>Đăng ký thành viên Fchic.vn</h1></div>
        <?php
        $form = $this->beginWidget('CActiveForm', array(
            'id' => 'register1-form',
            'enableClientValidation' => true,
            'clientOptions' => array(
                'validateOnSubmit' => true,
            ),
        ));
        ?>
        <div class="reg_half">
            <?php echo $form->textField($model, 'fullname', array('class' => 'input_text dlb', 'placeholder' => 'Họ và tên')); ?> 
            <?php echo $form->error($model, 'fullname'); ?>
            <?php echo $form->passwordField($model, 'password', array('class' => 'input_text dlb', 'placeholder' => 'Mật khẩu')); ?>  
            <?php echo $form->error($model, 'password'); ?>
            <?php echo $form->textField($model, 'email', array('class' => 'input_text dlb', 'placeholder' => 'Email đăng ký', 'style' => 'margin-bottom: 0')); ?>
            <?php echo $form->error($model, 'email'); ?>
        </div>
        <div class="reg_half_end">
            <h2>Bạn có thể sử dụng tài khoản mạng xã hội khác để đăng ký nhanh Fchic.vn</h2>
            <a href="<?php echo $facebook->getLoginUrl($params); ?>" title="Đăng ký qua Facebook" class="sprites reg_via_fb"></a>
            <a href="<?php // echo $tw_login_url;   ?>" title="Đăng ký qua Twitter" class="sprites reg_via_tw"></a>
        </div>
        <div class="clr"></div>
        <div class="dlb" style="margin-bottom: 15px;"><input type="checkbox" name="dieu-khoan" value="yes"> Tôi đã đọc và đồng ý với <a href="#" title="Điều khoản">điều khoản</a> của Fchic.vn</div>
            <?php echo CHtml::submitButton('Đăng ký', array('class' => 'gr_btn_big')); ?>
            <?php $this->endWidget(); ?>
    </div>
</div>
<!-- /register -->
